using System;
using System.Collections.Generic;
using System.Text;

namespace WowGuildSite.Armory
{
    public class ArmoryResistanceStats
    {
        private ArmoryCharacter character;

        public int              this[MagicType type]
        {
            get { return GetResistance(type); }
        }

        public int              ArcaneResistance
        {
            get { return GetResistance(MagicType.Arcane); }
        }

        public int              FireResistance
        {
            get { return GetResistance(MagicType.Fire); }
        }

        public int              FrostResistance
        {
            get { return GetResistance(MagicType.Frost); }
        }

        public int              HolyResistance
        {
            get { return GetResistance(MagicType.Holy); }
        }

        public int              NatureResistance
        {
            get { return GetResistance(MagicType.Nature); }
        }

        public int              ShadowResistance
        {
            get { return GetResistance(MagicType.Shadow); }
        }

        private int             GetResistance(MagicType type)
        {
            return character.SheetDocument.GetAttributeInt(String.Format("/page/characterInfo/characterTab/resistances/{0}/@value", type.ToString().ToLower()));
        }

        internal ArmoryResistanceStats( ArmoryCharacter character )
        {
            if (character == null)
            {
                throw new ArgumentNullException("character");
            }

            this.character = character;
        }
    }
}
